package com.ruoyi.mq.service.serviceImpl;

import com.alibaba.fastjson2.JSON;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author japhet_jiu
 * @version 1.0
 */
@Service
public class MsgServiceImpl {

    @Autowired
    private RabbitTemplate rabbitTemplate;
    /**
     * 路由key
     * @param exchangeName
     * @param routeKey
     * @param mapMsg
     */
    public void sendToManyConsumerByRoute(String exchangeName, String routeKey, Map<String, Object> mapMsg) {
        rabbitTemplate.convertAndSend(exchangeName,routeKey, JSON.toJSONString(mapMsg));
    }
}
